package com.zxp.springcloud.alibaba.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @description:
 * @author: 张新朋
 * @time: 2020/5/14 10:08
 */
@Configuration
public class ApplicationContextConfig {
    /*必须使用@LoadBalanced注解，要不然找不到微服务的名称*/
    @Bean
    @LoadBalanced
    public RestTemplate init(){
        return new RestTemplate();
    }
}